package com.wangsb;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @Description: TODO
 * @author: shenbing.wang@hand-china
 * @date: 2021年08月07日 9:36
 */
public class SortMapper extends Mapper<LongWritable, Text, SortBean, NullWritable> {

    private SortBean sortBean = new SortBean();
    private Text outK = new Text();
    //实现Map方法
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        sortBean.setSortFiled(Long.parseLong(line));
        sortBean.setSort(0L);

        context.write(sortBean, NullWritable.get());
    }
}
